/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author habib <imamhabibpamungkas@gmail.com>
 */
public class Median extends UkuranPemusatan {

    private static Data data;

    public static double hitung(Data dat) {
        double i = 0;
        data=dat;
        data.sortData();
        if (data.getSize() % 2 != 0) {
            i = data.getData(data.getSize() / 2);
        } else {
            int ind = ((data.getSize() / 2) + ((data.getSize() / 2) + 1)) / 2;
            i = data.getData(ind);
        }
        return i;
    }

}
